// component/collect_promt/collect_promt.js
var app = getApp();
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    animation:{
      type:Object
    },
    collectPrompt:{
      type:Boolean,
      value:false
    }

  },

  /**
   * 组件的初始数据
   */
  data: {
    
  },

  /**
   * 组件的方法列表
   */
  methods: {
    startPrompt:function(){

      var me = this;


      setInterval(function () {
        me.data.animation = wx.createAnimation({
          duration: 500


        });

        me.data.animation.scale(3, 3).step().scale(1, 1).step();
        me.setData({ animation: me.data.animation.export() });

      }.bind(me), 400);

    },
    closePrompt:function(){
      var me = this;
      
      app.util.request(
        {
          url:"entry/wxapp/unsetPrompt",
          data:{
            m:'rs_anwser',
            item: 'collect_prompt',
            openId:app.getOpenId()
          },
          success:function(data){
            me.setData({ collectPrompt: false });
            var userInfo = wx.getStorageSync('userInfo');
            userInfo.prompt.collect_prompt=false;
            wx.setStorageSync('userInfo', userInfo);
          }
        }
      )

    }

  }
})
